package com.amazon.ags.client;

import com.amazon.ags.api.AGHandleStatus;
import com.amazon.ags.api.AGResponseCallback;
import com.amazon.ags.api.AGResponseHandle;
import com.amazon.ags.api.RequestResponse;

public class GCResponseHandleImpl<T extends RequestResponse>
  implements AGResponseHandle<T>
{
  private AGResponseCallback<T> callback = null;
  private T response = null;
  private AGHandleStatus status = AGHandleStatus.WAITING;
  private final Object[] userData;

  public GCResponseHandleImpl(Object[] paramArrayOfObject)
  {
    this.userData = paramArrayOfObject;
  }

  private void callCallback()
  {
    if (this.callback == null);
    while ((this.response == null) || (this.callback == null))
      return;
    this.callback.onComplete(this.response);
  }

  public T getResponse()
  {
    try
    {
      RequestResponse localRequestResponse = this.response;
      return localRequestResponse;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public AGHandleStatus getStatus()
  {
    try
    {
      AGHandleStatus localAGHandleStatus = this.status;
      return localAGHandleStatus;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public void setCallback(AGResponseCallback<T> paramAGResponseCallback)
  {
    while (true)
    {
      try
      {
        if (this.callback != null)
        {
          i = 1;
          this.callback = paramAGResponseCallback;
          if ((i == 0) && (this.response != null))
            callCallback();
          return;
        }
      }
      finally
      {
      }
      int i = 0;
    }
  }

  public void setResponse(T paramT)
  {
    try
    {
      this.response = paramT;
      this.response.setUserData(this.userData);
      if (this.response.isError());
      for (this.status = AGHandleStatus.ERROR; ; this.status = AGHandleStatus.SUCCESS)
      {
        callCallback();
        return;
      }
    }
    finally
    {
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.amazon.ags.client.GCResponseHandleImpl
 * JD-Core Version:    0.6.2
 */